<?php 

	function test01() 
	{
	    echo 'success';
	}

	function seo_link_to($name = '', $objType, $objAction, $objId, $options = array()) 
	{
	    /* @var $seoUrl Seo */
		$html_options = _parse_attributes($options);
		$html_options = _convert_options_to_javascript($html_options);

	    $c = new Criteria();
		$c->add(SeoPeer::OBJ_TYPE, $objType);
		$c->add(SeoPeer::OBJ_ACTION, $objAction);
		$c->add(SeoPeer::OBJ_ID, $objId);
		$c->add(SeoPeer::CULTURE, sfContext::getInstance()->getUser()->getCulture());
		$seoUrl = SeoPeer::doSelectOne($c);
		sfLoader::loadHelpers('Tag', 'Url', 'Asset');
		// Create new Seo object if do not found in DB
		if (empty($seoUrl))
		{
		    return link_to(
		          $name
		          , $objType . '/' . $objAction . '?id=' . $objId
		          , $options
			);
		}
		
		
		return link_to(
		          $name
		          , $seoUrl->getUrl()
		          , $options
		);

	    $html_options['href'] = $seoUrl->getUrl();
		    
		return content_tag('a', $name, $html_options);
	}